<template>
  <view :style="colorStyle">

    <!-- #ifdef MP-WEIXIN -->
    <view :style="{'padding-top': sysHeight + 'px'}" class="w-full relative z-99">
      <!-- #endif -->

      <!-- #ifndef MP-WEIXIN -->
      <view class="w-full relative z-99" >
        <!-- #endif -->

        <!-- #ifdef MP-WEIXIN -->
        <view class="w-full px-20 pl-20 h-80 flex-between-center relative z-80">
          <text class="iconfont icon-ic_leftarrow fs-40 text&#45;&#45;w111-fff" @tap="goPage(3)"></text>
          <text class="fs-34 fw-500 text&#45;&#45;w111-fff">订单详情</text>
          <text></text>
        </view>
        <!-- #endif -->
        <view class="px-20 relative z-80">
          <view class="flex-between-center h-160">
            <view class="flex-1 text--w111-fff pl-12">
              <view class="fs-36 fw-500 lh-50rpx">{{orderInfo._status._title}}</view>
              <view class="fs-26 lh-36rpx mt-8">{{orderInfo._status._msg}}</view>
            </view>
            <image :src="orderInfo.status_pic" class="w-140 h-140"></image>
          </view>
          <view v-if="[1,3].includes(orderInfo.shipping_type) && orderInfo.product_type==0"
                class="bg--w111-fff rd-24rpx p-32 relative z-1">
            <view class="flex-between-center">
              <view class="flex-y-center fw-500 fs-30 lh-42rpx">
                <text class="iconfont icon-ic_location4 fs-30"></text>
                <text class="pl-12">{{orderInfo.real_name}}</text>
                <text class="pl-20">{{orderInfo.user_phone}}</text>
              </view>
              <view v-if="orderInfo.delivery_type == 'send' && orderInfo.verify_code"
                    class="w-154 h-56 rd-28rpx flex-center bg--w111-f5f5f5 fs-24 lh-34rpx"
                    @tap="showQrcode = true">
                <text class="iconfont icon-ic_QRcode fs-24"></text>
                <text class="pl-10">自提码</text>
              </view>
            </view>
            <view class="fs-24 text--w111-999 lh-34rpx mt-12 w-full line2 pb-8">{{orderInfo.user_address}}</view>
            <view v-if="orderInfo.delivery_type == 'send' && orderInfo.verify_code"
                  class="bt pt-32 flex-between-center mt-32">
              <view class="fs-26 text--w111-666 lh-34rpx flex-col">
                <text>配送员: {{orderInfo.delivery_name}}</text>
                <text class="pt-14">联系电话: {{orderInfo.delivery_id}}</text>
              </view>
              <view class="w-144 h-56 rd-30rpx flex-center fs-24  border bg--w111-fff"
                    @tap="makePhone(orderInfo.delivery_id)">拨打电话</view>
            </view>
            <!-- 完善资料 -->
            <view class="data-tip" v-if="showCompleteData" @click="goUserData()">
              <view class="l">完善身份信息可加速审核</view>
              <view class="r">去完善</view>
            </view>
            <image class="bt_line abs-lb" src="/static/images/line.jpg"></image>
          </view>
<!--          门店自提-->
          <view v-if="orderInfo.status < 2 && orderInfo.shipping_type === 2 && [0,4].includes(orderInfo.product_type)"
                class="bg--w111-fff rd-24rpx p-32 relative z-1">
            <view class="flex-between-center">
              <view class="h-128 flex-col justify-between">
                <view class="flex-y-center">
                  <view class="w-48 h-48 rd-50-p111- flex-center bg-primary-light font-num">
                    <text class="iconfont icon-a-ic_user1 fs-28"></text>
                  </view>
                  <view class="fs-28   fw-500 lh-40rpx pl-16">
                    <text>{{orderInfo.real_name}}</text>
                    <text class="pl-20">{{orderInfo.user_phone}}</text>
                  </view>
                </view>
                <view class="flex-y-center">
                  <view class="w-48 h-48 rd-50-p111- flex-center  bg-primary-light font-num">
                    <text class="iconfont icon-ic_mall fs-28"></text>
                  </view>
                  <view class="fs-28   fw-500 lh-40rpx pl-16">
                    <text>{{orderInfo.system_store.name}}</text>
                  </view>
                </view>
              </view>
              <image :src="system_store.image" class="w-128 h-128 rd-16rpx"></image>
            </view>
            <view class="mt-24 pb-24 border_bb flex justify-between">
              <view class="w-578 fs-24 text--w111-999">
                <view class="lh-34rpx line2">
                  地址: {{orderInfo.system_store.address}}{{orderInfo.system_store.detailed_address}}
                </view>
                <view class="mt-12">营业时间：每日{{orderInfo.system_store.day_time}} </view>
              </view>
              <text class="inline-block copy_btn fs-22  ml-32"
                    @tap="copy(orderInfo.system_store.detailed_address)">复制</text>
            </view>
            <view class="flex-between-center pt-24 fs-24">
              <view class="flex-y-center" @tap="showCodeChange">
                <text class="iconfont icon-ic_QRcode"></text>
                <text class="pl-8">出示自提码</text>
              </view>
              <view class="flex-y-center" @tap="makePhone(orderInfo.system_store.phone)">
                <text class="iconfont icon-ic_phone"></text>
                <text class="pl-8">联系门店</text>
              </view>
              <view class="flex-y-center" @tap="showMaoLocation">
                <text class="iconfont icon-ic_location"></text>
                <text class="pl-8">导航到门店</text>
              </view>
            </view>
          </view>
        </view>
        <view :style="{height: 213 + sysHeight + 'px'}" class="w-full bg-gradient abs-lt">
          <view class="w-full abs-lb white_jianbian z-20"></view>
        </view>
      </view>
      <view class="px-20 mt-20">
        <view class="bg--w111-fff rd-24rpx pt-32 pr-24 pl-24 pb-32 relative z-80">
          <view class="acea-row row-between row-middle mb-26">
            <view class="fs-28 lh-40rpx">{{orderInfo.add_time_y}} {{orderInfo.add_time_h}}</view>
            <view v-if="orderInfo.shipping_type === 2"
                  class="fs-24 lh-40rpx text--w111-999"
                  @tap="goPage(1,`/pages/admin/writeRecordList/index?id=${orderInfo.id}`)">核销记录<text class="iconfont icon-ic_rightarrow fs-24 ml-4"></text></view>
          </view>
          <view v-for="(item,index) in cartInfo" :key="index" class="order_goods">
            <!--          @tap="goPage(1,`/pages/goods_details/index?id=${item.product_id}`)"-->
            <view class="flex">
              <image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image' class="w-136 h-136 rd-16rpx"></image>
              <image v-else :src='item.productInfo.image' class="w-136 h-136 rd-16rpx"></image>
              <view class="flex-1 flex justify-between pl-20">
                <view class="w-360rpx">
                  <view class="w-full line2 fs-28 lh-40rpx">
                    <secondHandTag :lease_type="item.productInfo.lease_type" :level="item.productInfo.level" :new_old="item.productInfo.new_old"></secondHandTag>
                    {{item.productInfo.store_name}}</view>
                  <view class="w-full line1 fs-24 text--w111-999 lh-34rpx mt-8">{{item.productInfo.attrInfo.suk_alias}}</view>
<!--                  <view class="flex items-end flex-wrap mt-12 w-full">-->
<!--                    <BaseTag-->
<!--                        v-for="(label, idx) in item.productInfo.store_label"-->
<!--                        :key="idx"-->
<!--                        :background="label.bg_color"-->
<!--                        :borderColor="label.border_color"-->
<!--                        :circle="label.border_color ? true : false"-->
<!--                        :color="label.color"-->
<!--                        :imgSrc="label.icon" :text="label.label_name"></BaseTag>-->
<!--                  </view>-->
                </view>
                <view class="flex-1 flex-col items-end">
                  <!--								<baseMoney :money="item.productInfo.attrInfo ? item.productInfo.attrInfo.price : item.productInfo.price" symbolSize="20" integerSize="36" decimalSize="20" color="#333" weight></baseMoney>-->
                  <view class="fs-24 text--w111-999 lh-40rpx mt-10">共{{item.cart_num}}件</view>
                </view>
              </view>
            </view>
            <!-- 订单商品操作按钮 核销状态文字 退款状态文字 -->
            <view class="flex-between-center mt-32">
              <view v-if="[5,1,2,3].includes(status.type) && (orderInfo.shipping_type==2 || orderInfo.delivery_type=='send' || orderInfo.product_type == 4)" class="fs-24">
                <text v-if="item.is_writeoff">已核销</text>
                <text v-if="!item.is_writeoff && item.write_surplus_times < item.write_times">已核销{{parseInt(item.write_times)-parseInt(item.write_surplus_times)}}件</text>
                <text v-if="!item.is_writeoff && item.write_surplus_times == item.write_times">未核销</text>
              </view>
              <text v-if="item.refund_num && status.type !=-2" class="fs-24">{{item.refund_num}}件退款中</text>
              <view class="flex-1 flex-y-center justify-end">
                <!--							<view class="btn w-144 h-56 rd-30rpx flex-center fs-24   border bg&#45;&#45;w111-fff"-->
                <!--								v-if="orderInfo.is_apply_refund && orderInfo.refund_status === 0 && item.refund_num !=item.cart_num && Number(orderInfo.paid) && item.is_support_refund && orderInfo.type != 8 && orderInfo.type != 10"-->
                <!--								@tap.stop="openSubcribe(item,orderInfo.product_type)">申请退款</view>-->
                <!--							<view class="btn w-144 h-56 rd-30rpx flex-center fs-24 text&#45;&#45;w111-fff bg-color"-->
                <!--								v-if='evaluate==3 && item.is_reply==0 && pid != -1' @tap.stop="evaluateTap(item.unique,order_id)">立即评价</view>-->
              </view>
            </view>
          </view>
          <view v-if="giftCount > 0" class="cell flex justify-between mt-32">
            <text class="fs-28">赠品</text>
            <view class="w-460 flex-y-center justify-end" @tap="showGiftDrawer = true">
              <view class="flex">
                <view v-for="(item, index) in giveCartInfo" :key="item.id" class="w-64 h-64 mr-8">
                  <image v-if="item.productInfo.attrInfo" :src="item.productInfo.attrInfo.image" class="h-full w-full rd-8rpx"></image>
                  <image v-else :src="item.productInfo.image" class="h-full w-full rd-8rpx"></image>
                </view>
                <view v-if="giveData.give_coupon.length" class="w-64 h-64 rd-8rpx bg--w111-f5f5f5 flex-center mr-8">
                  <text class="gold iconfont icon-a-ic_discount1"></text>
                </view>
                <view v-if="giveData.give_integral>0" class="w-64 h-64 rd-8rpx bg--w111-f5f5f5 flex-center mr-8">
                  <text class="gold iconfont icon-ic_badge11"></text>
                </view>
              </view>
              <view class="fs-26 text--w111-666">共{{giftCount}}件 <text class="iconfont icon-ic_rightarrow"></text> </view>
            </view>
          </view>
          <view v-if="orderInfo.mark || orderInfo.refund_explain" class="cell flex justify-between mt-32">
            <text class="fs-28">{{isGoodsReturn ? '退款留言' : '买家备注'}}</text>
            <text class="  fs-28 w-544 text-right">{{!isGoodsReturn?orderInfo.mark:orderInfo.refund_explain}}</text>
          </view>
          <view v-if="orderInfo.refund_goods_explain" class="cell flex justify-between mt-32">
            <text class="fs-28">退货留言</text>
            <text class="fs-28 w-544 text-right">{{orderInfo.refund_goods_explain}}</text>
          </view>
          <view v-if="orderInfo.product_type == 1 && Array.isArray(orderInfo.virtual_info)" class="pt-32 bt mt-32">
            <view class="flex-between-center">
              <text class="fs-28">卡密发货</text>
              <text class="fs-28 card-pasd" @tap="copyCard()">复制全部</text>
            </view>
            <view v-for="(item,index) in orderInfo.virtual_info" :key="index" class="mt-16 bg--w111-f5f5f5 rd-16rpx p-24 lh-36rpx">
              <view class="flex-between-center">
                <text class="fs-28">卡号:</text>
                <text class="fs-36 card-pasd iconfont icon-ic_copy" @tap="copy(item.card_no)"></text>
              </view>
              <view class="fs-26 text--w111-999 mt-8">{{item.card_no}}</view>
              <view class="flex-between-center mt-24">
                <text class="fs-28">密码:</text>
                <text class="fs-36 card-pasd iconfont icon-ic_copy" @tap="copy(item.card_pwd)"></text>
              </view>
              <view class="fs-26 text--w111-999 mt-8">{{item.card_pwd}}</view>
            </view>
          </view>
          <view v-else-if="orderInfo.product_type == 1" class="mt-32">
            <view class="flex-between-center mt-32">
              <text class="fs-28">卡密发货</text>
              <text class="fs-28 card-pasd" @tap="copy(orderInfo.virtual_info)">复制文本</text>
            </view>
            <view class="mt-16 bg--w111-f5f5f5 text--w111-999 rd-16rpx p-24 lh-36rpx"
            >{{orderInfo.virtual_info}}</view>
          </view>
        </view>
        <!-- #ifdef MP -->
        <!-- 桌码 -->
        <view v-if="orderInfo.type == 10" class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
          <view class="cell flex-between-center">
            <text class="fs-28">桌台号</text>
            <text class="fs-28">{{tableCode.category.name}}{{tableCode.table_number}}</text>
          </view>
          <view class="cell flex-between-center">
            <text class="fs-28">就餐人数</text>
            <text class="fs-28">{{tableCode.number_diners}}</text>
          </view>
        </view>
        <!-- #endif -->
        <!--        租期范围-->
        <view v-if="leaseTime.start" class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32 fs-28 text--w111-333">
          <view class="lease-area">
            <view class="time fs-26 flex-between-center">
              <view class="l">
                <view class="tag">租</view>
                <view class="txt">{{leaseTime.start}}</view>
              </view>
              <view class="c fs-24 fw-bold relative">
                <view class="c-line-l"></view>
                <view class="c-day">共{{ leaseTime.duration }}天</view>
                <view class="c-line-r"></view>
              </view>
              <view class="r">
                <view class="tag tag2">还</view>
                <view class="txt txt2">{{leaseTime.end}}</view>
              </view>
            </view>
            <view class="tip mt-16 fs-24 text--w111-999">快递期间不算租期，实际起租日以快递签收日为准</view>
          </view>
        </view>

        <view class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32 fs-28 text--w111-333">
          <!-- 租赁信息 -->
          <view class="cell flex-between-center">
            <text>首期租金</text>
            <view>
              <text>
                <!-- 0元随心租 -->
                <text v-if="is_super" class="fs-20 fw-500">￥</text>
                <text v-if="is_super" class="fs-30 fw-bold Regular mr-10">0</text>
<!--                真实价格-->
                <text :class="{'line-money':is_super}" class="fs-20 fw-500">￥</text>
                <text :class="{'line-money':is_super}" class="fs-30 fw-bold Regular">{{orderLease.first_rent}}</text>
              </text>
<!--              公域优惠前价格-->
              <text class="text--w111-999 ml-10" v-if="orderInfo.first_before_promo_price && orderInfo.first_before_promo_price>orderLease.first_rent">
                <text class="ml-10 fs-20 fw-500">￥</text>
                <text class="fs-30 fw-bold Regular line-through">{{orderInfo.first_before_promo_price}}</text>
              </text>
            </view>
          </view>
          <view class="cell flex-between-center" v-if="orderLease.deposit>0">
            <text>补充押金</text>
            <view>
              <text class="fs-20 fw-500">￥</text>
              <text class="fs-30 fw-bold Regular">
                {{orderLease.deposit}}
              </text>
            </view>
          </view>
          <view class="cell flex-between-center text--w111-333">
            <text>总租金</text>

            <view >
              <text>
                <!-- 0元随心租 -->
                <text v-if="is_super" class="fs-20 fw-500">￥</text>
                <text v-if="is_super" class="fs-30 fw-bold Regular mr-10">0</text>
<!--                真实价格-->
                <text :class="{'line-money':is_super}" class="fs-20 fw-500">￥</text>
                <text :class="{'line-money':is_super}" class="fs-30 fw-bold Regular  ">{{orderInfo.total_price}}</text>
              </text>
              <!--  公域优惠前价格 -->
              <text class="text--w111-999 ml-10" v-if="orderInfo.before_total_price && orderInfo.before_total_price>orderInfo.total_price">
                <text class="fs-20 fw-500">￥</text>
                <text class="fs-30 fw-bold Regular line-through">{{orderInfo.before_total_price}}</text>
              </text>
            </view>
          </view>
          <!-- 只有一期则不显示 -->
          <!--        <view class="cell flex-between-center" v-if="orderLease.lease_num!==0||orderLease.lease_num!==1">-->
          <!--          <text>每期应付（除首期）</text>-->
          <!--          <view @click="instal.show = true">-->
          <!--            <text class="fs-20 fw-500">￥</text>-->
          <!--            <text class="fs-30 fw-bold Regular">{{orderLease.per_price}} x {{orderLease.lease_num-1}}</text>-->
          <!--            <text class="iconfont icon-ic_rightarrow fs-24"></text>-->
          <!--          </view>-->
          <!--        </view>-->
          <view v-if="buyout_money_end>0" class="cell flex-between-center">
            <text>到期买断尾款</text>
            <view>
              <text class="fs-20 fw-500">￥</text>
              <!--            <text class="fs-30 fw-bold Regular">{{orderLease.buyout_money}}</text>-->
              <text class="fs-30 fw-bold Regular">{{buyout_money_end}}</text>
            </view>
          </view>


          <view class="cell flex-between-center" v-if="orderInfo.promotions_price && orderInfo.promotions_price>0">
            <text>优惠合计</text>
            <view class="text-red" @click="couponShow=true">
              <text class="fs-20 fw-500">-￥</text>
              <text class="fs-30 fw-bold Regular">
                {{orderInfo.promotions_price}}
                <text class="iconfont icon-ic_rightarrow fs-24"></text>
              </text>
            </view>
          </view>
          <!--        <view v-if="aliCouponMoney.merchant_total_amount>0" class="cell flex-between-center">-->
          <!--          <text>商家优惠</text>-->
          <!--          <view class="text-red">-->
          <!--            <text class="fs-20 fw-500">-￥</text>-->
          <!--            <text class="fs-30 fw-bold Regular">-->
          <!--              {{aliCouponMoney.merchant_total_amount}}-->
          <!--            </text>-->
          <!--          </view>-->
          <!--        </view>-->
          <!--				<view class="cell flex-between-center">-->
          <!--					<text class="fs-28">商品总价</text>-->
          <!--					<text class="fs-28">￥{{(parseFloat(orderInfo.total_price)+parseFloat(orderInfo.vip_true_price)).toFixed(2)}}</text>-->
          <!--				</view>-->
<!--          <view v-if="orderInfo.pay_postage > 0" class="cell flex-between-center">-->
<!--            <text class="fs-28">运费</text>-->
<!--            <text class="fs-30 fw-bold Regular">￥{{parseFloat(orderInfo.pay_postage).toFixed(2)}}</text>-->
<!--          </view>-->
          <view v-if="orderInfo.freight_price > 0" class="cell flex-between-center">
            <text class="fs-28">运费</text>
            <text class="fs-30 fw-bold Regular">￥{{parseFloat(orderInfo.freight_price).toFixed(2)}}</text>
          </view>
          <view v-if="orderInfo.vip_true_price > 0" class="cell flex-between-center">
            <text class="fs-28">会员优惠</text>
            <text class="fs-30 fw-bold Regular text-red">-￥{{parseFloat(orderInfo.vip_true_price).toFixed(2)}}</text>
          </view>
          <view v-if='orderInfo.coupon_id' class="cell flex-between-center">
            <text class="fs-28">优惠券抵扣</text>
            <text class="fs-30 fw-bold Regular text-red">-￥{{parseFloat(orderInfo.coupon_price).toFixed(2)}}</text>
          </view>
          <view v-if="orderInfo.use_integral > 0" class="cell flex-between-center">
            <text class="fs-28">里程币抵扣</text>
            <text class="fs-30 fw-bold Regular">-￥{{parseFloat(orderInfo.deduction_price).toFixed(2)}}</text>
          </view>
          <!-- 里程币订单需要展示的抵扣里程币数量 -->
          <view v-if="orderInfo.type == 4" class="cell flex-between-center">
            <text class="fs-28">实付里程币</text>
            <text class="fs-30 fw-bold Regular">-{{orderInfo.pay_integral}}</text>
          </view>
          <!-- 抵扣里程币 -->
          <view v-for="(item,index) in orderInfo.promotions_detail"
                v-show="parseFloat(item.promotions_price)" :key="index"
                class="cell flex-between-center">
            <text class="fs-28">{{item.title}}</text>
            <text class="fs-30 fw-bold Regular">-￥{{parseFloat(item.promotions_price).toFixed(2)}}</text>
          </view>
          <!--				<view class="cell flex-between-center">-->
          <!--					<text class="fs-28">实付款</text>-->
          <!--					<text class="fs-28">￥{{parseFloat(orderInfo.pay_price).toFixed(2)}}</text>-->
          <!--				</view>-->
        </view>

<!--        <view class="mt-20 bg&#45;&#45;w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32 fs-28 text&#45;&#45;w111-333" v-if="is_super > 0">-->
<!--          <view class="cell flex-between-center">-->
<!--            <text>尊享0元租</text>-->
<!--            <view>-->
<!--              <text>-->
<!--                <text class="fs-20 fw-500">￥</text>-->
<!--                <text class="fs-30 fw-bold Regular">0</text>-->
<!--              </text>-->
<!--              -->
<!--            </view>-->
<!--          </view>-->
<!--        </view>-->

        <view v-if="orderInfo.added_service_detail || orderInfo.card_amount>0" class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32 fs-28 text--w111-333">
          <view v-if="orderInfo.added_service_detail" class="cell flex-between-center collapse-box" style="align-items: flex-start">
            <text class="white-nowrap">增值服务</text>
            <view class="pl-56">
              <uni-collapse ref="collapse" class="collapse-box1">
                <uni-collapse-item title-border="none">
                  <template v-slot:title >
                    <view>
                      <text class="fs-20 fw-500">￥</text>
                      <text class="fs-30 fw-bold Regular">{{orderInfo.added_service_amount}}</text>
                    </view>
                  </template>
                  <view class="content">
                    <view v-for="(item,index) in JSON.parse(orderInfo.added_service_detail)" :key="index"  class="mb-4">
                      {{item.name}} &nbsp;
                      <text class="fs-20 fw-500">￥</text>
                      <text class="fs-24 fw-bold Regular">{{ item.price }}</text>
                    </view>
                  </view>
                </uni-collapse-item>
              </uni-collapse>
            </view>
          </view>
          <view class="cell flex-between-center" @click="goUserCard" v-if="orderInfo.card_amount>0">
            <text>
              卡项权益
            </text>
            <view>
              <text class="fs-20 fw-500">￥</text>
              <text class="fs-30 fw-bold Regular">
                {{orderInfo.card_amount}}
              </text>
              <text class="ebao-iconfont ebao-youjiantou text-blue fw-bold"></text>
            </view>
          </view>
        </view>
        <!-- 自定义表单内容 -->
        <view v-if="orderInfo.custom_form && orderInfo.custom_form.length" class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
          <view v-for="(item,index) in orderInfo.custom_form" :key="index" class="cell flex justify-between">
            <text class="  fs-28">{{item.titleConfig.value}}</text>
            <view v-if="item.name == 'uploadPicture' && item.value.length < 5"  class="w-462 flex justify-end">
              <view v-for="(items,indexs) in item.value" :key="indexs" class='pictrue mr-8'>
                <image :src='items' class="w-88 h-88 rd-8rpx" mode="aspectFill"></image>
              </view>
            </view>
            <scroll-view v-else-if="item.name == 'uploadPicture' && item.value.length >= 5" class="white-nowrap vertical-middle w-462"
                         scroll-with-animation scroll-x="true"
                         show-scrollbar="false">
              <view v-for="(items,indexs) in item.value" :key="index" class="inline-block mr-12">
                <image :src="items" class="w-88 h-88 rd-8rpx"></image>
              </view>
            </scroll-view>
            <view v-else-if="item.name == 'dateranges'" class="  fs-28">
              <text v-if="item.value.length">{{item.value[0]+'/'+item.value[1]}}</text>
            </view>
            <text v-else class="fs-28">{{item.value}}</text>
          </view>
        </view>
        <view class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
          <view v-if="orderInfo.order_lease && orderInfo.order_lease.contract_status===2" class="cell flex-between-center">
            <text class="fs-28">租赁合同</text>
            <view>
              <text class="inline-block copy_btn fs-24" style="color: #2d8cf0" @click="goContract()">查看</text>
            </view>
          </view>
          <view class="cell flex-between-center">
            <text class="fs-28">订单编号</text>
            <view>
              <text class="fs-28 pr-12">{{orderInfo.order_id}}</text>
              <text class="inline-block copy_btn fs-22  " @tap="copy(orderInfo.order_id)">复制</text>
            </view>
          </view>
          <view v-if="orderInfo.refunded_price" class="cell flex-between-center">
            <text class="fs-28">退款金额</text>
            <text class="fs-28">￥{{orderInfo.refunded_price}}</text>
          </view>
          <view class="cell flex-between-center">
            <text class="fs-28">下单时间</text>
            <text class="fs-28">{{(orderInfo.add_time_y || '') +' '+(orderInfo.add_time_h || 0)}}</text>
          </view>
          <view class="cell flex-between-center">
            <text class="fs-28">支付状态</text>
            <text class="fs-28">{{ orderInfo.paid ? '已支付' : '未支付' }}</text>
          </view>
          <view v-if="orderInfo.deposit_record && orderInfo.deposit_record.id" class="cell flex-between-center">
            <text class="fs-28">补充押金状态</text>
            <text class="fs-28">
              {{depositStatus[orderInfo.deposit_record.status]}}
            </text>
          </view>
          <view class="cell flex-between-center">
            <text class="fs-28">支付方式</text>
            <!--					<text class="fs-28">-->
            <!--            {{orderInfo._status._payType}}-->
            <!--          </text>-->
            <text v-if="orderInfo.order_lease.check_type===1" class="fs-28">
              预授权代扣
            </text>
            <text v-else-if="orderInfo.order_lease.check_type===2" class="fs-28">
              智能合同代扣
            </text>
          </view>
        </view>
        <view v-if="orderInfo.status !=0">
          <view v-if='orderInfo.delivery_type=="express"' class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
            <view class="cell flex-between-center">
              <text class="fs-28">配送方式</text>
              <text class="fs-28">发货</text>
            </view>
            <view class="cell flex-between-center">
              <text class="fs-28">快递公司</text>
              <text class="fs-28">{{orderInfo.delivery_name || ''}}</text>
            </view>
            <view class="cell flex-between-center">
              <text class="fs-28">快递单号</text>
              <text class="fs-28">{{orderInfo.delivery_id || ''}}</text>
            </view>
          </view>
          <view v-if='orderInfo.delivery_type=="send"' class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
            <view class="cell flex-between-center">
              <text class="fs-28">配送方式</text>
              <text class="fs-28">送货</text>
            </view>
            <view class="cell flex-between-center">
              <text class="fs-28">配送人姓名</text>
              <text class="fs-28">{{orderInfo.delivery_name || ''}}</text>
            </view>
            <view class="cell flex-between-center">
              <text class="fs-28">联系电话</text>
              <text class="fs-28" @tap="makePhone(orderInfo.delivery_id)">{{orderInfo.delivery_id || ''}}</text>
            </view>
          </view>
          <view v-if='orderInfo.delivery_type=="fictitious" && orderInfo.product_type!=1' class="mt-20 bg--w111-fff rd-16rpx pt-32 pr-24 pl-24 pb-32">
            <view class="cell flex-between-center fs-28">
              <text class="fs-28">虚拟发货</text>
              <text class="fs-28">已发货，请注意查收</text>
            </view>
            <view v-if="orderInfo.fictitious_content" class="cell flex-between-center fs-28">
              <text class="fs-28">虚拟备注</text>
              <text class="fs-28 text-right flex-1 pl-20">{{orderInfo.fictitious_content}}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="h-200 pb-safe"></view>
      <view class='fixed-lb bt w-full bg--w111-fff pb-safe z-80'>
        <!--      快捷下单已取消-->
        <!--      <view v-if="status.type==9999" class="h-96 px-20 flex-y-center">-->
        <!--        <view class="flex-y-center justify-end flex-1">-->
        <!--            <view-->
        <!--              @tap="goPage(1,`/pages/goods_details/index?id=${cartInfo[0].product_id}`)"-->
        <!--              class="btn w-144 h-56 rd-30rpx flex-center fs-24 text&#45;&#45;w111-fff bg-color"-->
        <!--            >再次购买</view>-->
        <!--        </view>-->
        <!--      </view>-->

        <!-- 代客下单：修改地址-->
        <view v-if="orderInfo._status._type == 0 && orderInfo.clerk_id" class="h-96 px-20 flex-y-center">
          <view class="flex-y-center justify-end flex-1">
            <view
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @click="$refs.popup.open()"
            >修改地址</view>
          </view>
        </view>



        <!-- 正常订单-->
        <view v-else class="btn-scroll h-96 px-20 flex-y-center">
          <view class="btn-con flex-y-center flex-1">
            <view class="btn px-12 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                  @tap='toChat'>
              <text class="iconfont icon-ic_customerservice"></text>
            </view>
            <!-- 人脸认证-->
            <view
                v-if="orderInfo._status._type == 99"
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @click="daikeCheck()"
            >人脸认证</view>
            <view
                v-if="[3,31].includes(orderInfo._status._type) && orderInfo.order_lease.is_buyout==1"
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @click="goBuyout()"
            >买断</view>
            <!-- 归还商品   -->
            <view
                v-if="status.type==31"
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @click="returnGoods()"
            >归还</view>
            <view
                v-if="orderInfo.back_id>0 && orderInfo.return_pay_postage>0"
                @click="returnRecord()"
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
            >归还记录</view>
            <view
                v-if="orderInfo.order_lease.is_relet==1 && orderInfo.order_lease.lease_status==5"
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @click="goXuzu()"
            >续租</view>
            <view
                v-if="showCompleteData && orderInfo.order_lease.contract_status===2"
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @click="goUserData()"
            >
              完善资料
            </view>
            <!-- 签合同 -->
            <view
                v-if="status.type==101 && orderInfo.order_lease.contract_detail"
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @click="esign_contract(orderInfo)"
            >
              <!--            {{ orderInfo.order_lease.check_type == 2 ? '租赁宝' : '签合同' }}-->
              签署合同
            </view>
            <!-- 代扣 -->
            <view
                v-if="status.type==202" class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @click="ato_withhold(orderInfo, 'pages/goods/lease_order_details/index')"
            >签约代扣</view>


            <view
                v-if="status.type == 103"
                class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color"
                @tap='payAlipay(orderInfo.id,1)'
            >支付首期</view>

            <!--          <view -->
            <!--						@tap='zhimaPay()'-->
            <!--						class="btn w-144 h-56 rd-30rpx flex-center fs-24 text&#45;&#45;w111-fff bg-color"-->
            <!--						v-if="status.type == 103 && orderInfo.order_lease.check_type == 1"-->
            <!--					>支付首期</view>	-->
            <!--					-->
            <!--					<view-->
            <!--						@tap='createWithholdActivepay()'-->
            <!--						class="btn w-144 h-56 rd-30rpx flex-center fs-24 text&#45;&#45;w111-fff bg-color"-->
            <!--						v-if="status.type == 103 && orderInfo.order_lease.check_type == 2"-->
            <!--					>支付首期</view>	-->


            <!--  免押-逻辑：lease_check_type:后台配置了代扣签约类型为全部0或者芝麻免押1、freeze_status:免押状态<1、check_type:芝麻免押预授权代扣(旧)1租赁行业交易(新芝麻免押代扣)3 -->
            <view v-if="orderInfo.order_lease && [0,1].includes(orderInfo.order_lease.lease_check_type) && [1,3].includes(orderInfo.order_lease.check_type) && orderInfo.order_lease.freeze_status < 1"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color" @tap='zhimaCreatePre(orderInfo.id)'>再次免押</view>
            <!--  押金-逻辑： 押金状态待支付、订单收货之前-->
            <view v-if="orderInfo.deposit_record && orderInfo.deposit_record.status==0 && orderInfo.status < 2" class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color" @tap='depositPay()'>支付押金</view>
<!--            <view v-if="orderInfo.order_lease.check_type !=1 && orderInfo.order_lease.freeze_status < 1"-->
<!--                  class="btn w-144 h-56 rd-30rpx flex-center fs-24 text&#45;&#45;w111-fff bg-color" @tap='changeCheckType()'>直接下单</view>-->
            <view v-if="invoice_func && !invoiceData && orderInfo.type != 8 && status.type !=-2 && (orderInfo.type != 9 || orderInfo.shipping_type == 2)"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24   border bg--w111-fff" @tap="invoiceApply">申请开票</view>
            <view v-if="invoiceData"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24   border bg--w111-fff" @tap="goPage(1,`/pages/users/user_invoice_order/index?order_id=${orderInfo.order_id}`)">查看发票</view>
<!--未发货之前，可以取消-->
            <view v-if="orderInfo.status < 1 && status.type!=9999"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24   border bg--w111-fff" @tap="showModalChange(3)">取消订单</view>
            <view v-if="orderInfo.type==3 && orderInfo.paid && orderInfo.refund_status==0"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24   border bg--w111-fff"
                  @tap="goJoinPink">查看拼团</view>
            <view v-if="orderInfo.delivery_type == 'express' && status.class_status==3 && status.type==2 && !split.length"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24   border bg--w111-fff"
                  @tap="goPage(1,`/pages/goods/goods_logistics/index?orderId=${orderInfo.order_id}`)">查看物流</view>
            <view v-if="orderInfo.type == 9"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24 font-num con_border bg--w111-fff"
                  @tap="goPage(1,`/pages/store/group_goods/index?collage_id=${orderInfo.activity_id}`)"
            >拼单详情</view>
            <view v-if="status.class_status==3 && !split.length"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color" @tap='confirmOrder()'>确认收货</view>
            <!--					<view class="btn w-144 h-56 rd-30rpx flex-center fs-24   border bg&#45;&#45;w111-fff"-->
            <!--						v-if="status.type==4 &&  !split.length ||status.type==-2" @tap='showModalChange(2)'>删除订单</view>-->
            <!--				<view class="btn w-144 h-56 rd-30rpx flex-center fs-24 font-num con_border bg&#45;&#45;w111-fff"-->
            <!--					v-if="status.class_status==5" @tap='goOrderConfirm'>再次购买</view>-->
            <view v-else-if="orderInfo.is_apply_refund && orderInfo.refund_status == 0 && cartInfo.length>1 && orderInfo.paid && orderInfo.type != 10 && (orderInfo.type != 9 || orderInfo.shipping_type == 2)"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24 font-num con_border bg--w111-fff"
                  @tap="openAfter(`/pages/goods/${cartInfo.length > 1 ? 'goods_return_list' : 'goods_return'}/index?orderId=`+orderInfo.order_id+ '&id=' + orderInfo.id + '&store_id=' + orderInfo.store_id)"
            >批量退款</view>
            <view v-if='evaluate==3 && cartInfo[0].is_reply==0 && pid != -1'
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color" @tap.stop="evaluateTap(cartInfo[0].unique,order_id)">立即评价</view>
            <view v-if="!is_super&&orderInfo.paid"
                  class="btn w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg-color" @tap='goInstallment'>租金账单</view>

          </view>
        </view>
      </view>
      <verifyModal
          type='codeToImg'
          :productType="orderInfo.product_type"
          :qrc="qrc"
          :qrcode="config.qrc"
          :verifyCode="orderInfo._verify_code"
          :visible="showQrcode"
          :writeDay="orderInfo.write_day"
          :writeOff="orderInfo.write_off"
          :writeTimes="orderInfo.write_times"
          @closeModal="()=>{showQrcode = false}"></verifyModal>
      <view v-if="moreBtn" class="mask more-mask" @tap="moreBtn = false"></view>
      <invoice-picker :inv-checked="invChecked" :inv-list="invList" :inv-show="invShow" :is-order="1"
                      :is-special="special_invoice" :order-id='order_id' @inv-close="invClose" @inv-change="invSub" @inv-cancel="invCancel">
      </invoice-picker>
      <!-- 赠品抽屉 -->
      <giftDrawer :giveCartInfo="giveCartInfo" :giveData="giveData" :visible="showGiftDrawer" @closeDrawer="closeDrawer"></giftDrawer>
      <!-- 确认框 -->
      <tuiModal
          :content="modalContent"
          :maskClosable="false"
          :show="showModal"
          :title="modalTitle"
          @cancel="hideModal"
          @click="handleTap"></tuiModal>
      <installment :instal="instal" :paid="orderInfo.paid" @close="()=>{instal.show = false}"></installment>

      <!-- 代客下单 -->
      <uni-popup class="daike-pop" ref="popup" :maskClick="false"
                 border-radius="10px 10px 0 0"
                 type="center">
        <view :class="{'has-code': orderInfo._status._type===98}" class="daike-tip">
          <view class="title text-center">
            收货地址<text v-if="!userInfo.real_name">&实名认证</text>
          </view>

          <!-- 1，选择地址(要重新选，因为绑定接口需要地址id) -->
          <view class='mb-50 address add1 flex-between-center'
                @tap='openAddress'>
            <view class="has-address" v-if="addressInfo.real_name">
              <view class="fs-30 text--w111-333 fw-500 acea-row row-middle">
                <text>{{addressInfo.real_name}}</text> <text class='pl-20'>{{addressInfo.phone}}</text>
                <text class='default acea-row row-center-wrapper ml-8' v-if="addressInfo.is_default">默认</text>
              </view>
              <view class="fs-24 text--w111-666 mt-12">{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.street}}{{addressInfo.detail}}</view>
            </view>
            <view class='no-address fs-30 text--w111-333 fw-500 lh-42rpx flex-y-center' v-else>
              <image src="../static/location_order_icon.png" class="w-32 h-32"></image>
              <text class="pl-8">选择收货地址</text>
            </view>
            <text class="iconfont icon-ic_rightarrow fs-32 text--w111-666 ml-20"></text>
          </view>

          <!-- 2，填写身份证（已实名的则隐藏，传值即可） -->
          <view v-if="!userInfo.real_name">
            <view class='flex align-item-center mb-50'>
              <view class='name mr-20 white-nowrap'>真实姓名</view>
              <view class="flex align-item-center">
                <input v-model="daikeUser.real_name" :disabled="idDisabled" type='text' class="b-fa h-60 pl-10" placeholder='请输入姓名' name='real_name'  placeholder-class='placeholder'></input>
                <view v-if="hasIdApi" class="btn-default btn-blue ml-10" @click="getId">
                  一键录入
                </view>
              </view>
            </view>
            <view class='flex align-item-center mb-50'>
              <view class='name mr-20'>身份证号</view>
              <input v-model="daikeUser.card_id" :disabled="idDisabled" type='text' class="b-fa h-60 pl-10" placeholder='请输入身份证号' name='real_name'  placeholder-class='placeholder'></input>
            </view>
          </view>

          <!-- 3，人脸核验 -->
<!--          <view v-if="orderInfo._status._type===99" class="tip4">-->
<!--            <view>前往人脸认证信息核验</view>-->
<!--          </view>-->


          <!--      待绑定，输入身份证号-->
<!--          <view v-if="orderInfo._status._type===98" class="tip3">-->
<!--            <view class="tip">请输入身份证号后6位</view>-->
<!--            <view class="mt-20">-->
<!--              <yi-code :focus="false" :maxlength="6" @onChange="codeInput"></yi-code>-->
<!--              &lt;!&ndash;              <input v-model="cardId" class="rd-4rpx bg&#45;&#45;w111-f5f5f5 flex-center text-center fs-24 text&#45;&#45;w111-333"/>&ndash;&gt;-->
<!--            </view>-->
<!--          </view>-->
          <!--          已注册的用户-->

          <button class="ok" @click="daikeConfirm()">确定</button>
        </view>
      </uni-popup>

      <addressWindow ref="addressWindow" :isDaike="true" :pagesUrl="pagesUrl" :address='address' @OnChangeAddress="OnChangeAddress" @changeClose="changeClose"></addressWindow>

      <!--   提示支付宝开启定位权限   -->
      <uni-popup ref="latShow" :maskClick="false"
                 border-radius="10px 10px 0 0"
                 type="center">
        <view class="daike-tip" style="width: 66vw">
          <view class="title">提示</view>
          <view class="tip3" >
            <view class="tip mb-16">请先授权位置权限</view>
            <view class="tip">若授权失败，解决方案如下：</view>
            <view class="tip">1.点击小程序右上角三个点，点击设置，打开地理位置权限</view>
            <view class="tip">2.在手机设置里，打开支付宝APP位置权限</view>
          </view>
          <button @click="getOrderInfo()">确定</button>
        </view>
      </uni-popup>

      <base-drawer
          :visible="couponShow"
          background-color="transparent" mask
          maskClosable
          mode="bottom" @close="couponShow=false"
      >
        <view class="pop-box w-full bg--w111-f5f5f5 rd-t-40rpx">
          <view class="text-center py-24">
            <view class="fs-30 fw-bold">优惠合计</view>
          </view>
          <view class="px-20 main mt-20">
            <view class="item  flex-between-center p-20">
              <view class="l">商家优惠</view>
              <view class="r text-red fw-bold Regular">-￥{{orderInfo.merchant_promo_price}}</view>
            </view>
            <view class="item flex-between-center p-20">
              <view class="l">平台优惠</view>
              <view class="r text-red fw-bold Regular">-￥{{orderInfo.platform_promo_price}}</view>
            </view>
          </view>
        </view>
      </base-drawer>
      <chatModal ref="chatModal"></chatModal>
    </view>
</template>
<script>
import secondHandTag from "@/components/secondHandTag/index.vue";
import installment from "@/pages/goods/components/installment/index.vue";
import auto from '@/mixins/auto'
import zhima from '@/mixins/zhima'
let sysHeight = uni.getSystemInfoSync().statusBarHeight;
import {
  getOrderDetail,
  getRefundOrderDetail,
  orderAgain,
  orderTake,
  orderDel,
  refundOrderDel,
  orderCancel,
  refundExpress, zhimaCreate, zhimaPay, getPublicOrderDetail,
} from '@/api/order.js';
import {
  openOrderRefundSubscribe
} from '@/utils/SubscribeMessage.js';
import {
  getAddressDefault,
  getUserInfo,
  invoiceList,
  makeUpinvoice, ocrIdcard
} from '@/api/user.js';
import {
  activityCodeApi
} from '@/api/activity.js';
import {
  getCodeData
} from '@/api/store.js';
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
import {toLogin} from '@/libs/login.js';
import {mapGetters} from "vuex";
import colors from "@/mixins/color";
import contract from "@/mixins/contract.js";
import invoicePicker from '../components/invoicePicker';
import verifyModal from '../components/verifyModal/index.vue'
import giftDrawer from '../components/giftDrawer/index.vue'
import tuiModal from "@/components/tui-modal/index.vue"
import {createWithholdActivepay, daikeBind, queryWithholdActivepay} from "@/api/leaseOrder";
import UniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
import {bingAdminOrder, changeCheckType, depositPay, getDownLoadUrl, tradeCreate} from "../../../api/order";
import {leasePay} from "../../../api/leaseOrder";
import moment from "moment";
import {completeData} from "@/tools/user";
import emptyPage from "@/components/emptyPage.vue";
import addressWindow from "@/components/addressWindow/index.vue";
import {appCanGetId} from "@/config/app";
import Routine from "@/libs/routine";
import {bindingAlipayAuth} from "@/api/public";
import {bookZfbMsg} from "@/tools/goods";
import leaseOrder from "@/pages/goods/js/leaseOrder";
import chatModal from '@/components/chatModal'
export default {
  components: {
    chatModal,
    addressWindow,
    emptyPage,
    UniPopup,
    installment,
    invoicePicker,
    verifyModal,
    giftDrawer,
    tuiModal,
    secondHandTag
  },
  mixins: [auto,colors, contract,leaseOrder,zhima],
  data() {
    return {
      faceTimes:0,
      // 代客-选择地址
      addressInfo:{},
      showAddressDrawer:false,
      addressId:'',
      addressList: [],
      address: { address: false }, //地址组件
      pagesUrl:'',
      daikeUser:{
        real_name:'',
        card_id:''
      },
      hasIdApi:false,
      idDisabled:false,

      showCompleteData:false,
      depositStatus:{
        0:'未支付',
        1:'已支付',
        2:'退款中',
        3:'已退款'
      },
      couponShow:false,
      latTip:'',
      cardId:'',
      sysHeight:sysHeight,
      giveData: {
        give_integral: 0,
        give_coupon: []
      },
      giveCartInfo: [],
      config: {
        qrc: {
          code: "",
          size: 360, // 二维码大小
          level: 4, //等级 0～4
          bgColor: '#FFFFFF', //二维码背景色 默认白色
          color: ['#333', '#333'], //边框颜色支持渐变色
        }
      },
      order_id: '',
      evaluate: 0,
      cartInfo: [], //购物车产品
      pid: 0, //上级订单ID
      split: [], //分单商品
      orderInfo: {
        system_store: {},
        _status: {}
      }, //订单详情
      aliCouponMoney: {
        platform_total_amount: 0,
        merchant_total_amount: 0,
        total_price: 0,
        total_amount: 0,
        first_amount: 0,
        installment_plan_promo_detail_info_list: []
      }, // 支付宝优惠金额
      system_store: {},
      isGoodsReturn: false, //是否为退款订单
      status: {}, //订单底部按钮状态
      refund_close: false,
      isClose: false,
      pay_close: false,
      pay_order_id: '',
      totalPrice: '0',
      isAuto: false, //没有授权的不会自动授权
      isShowAuth: false, //是否隐藏授权
      routineContact: 0,
      express_num: '',
      invoice_func: false,
      invoiceData: {},
      invoice_id: 0,
      invChecked: '',
      moreBtn: false,
      invShow: false,
      special_invoice: false,
      invList: [],
      userInfo: {},
      isReturen: '',
      showQrcode: false,
      showGiftDrawer: false,
      showModal: false,
      modalTitle: '',
      modalContent: '',
      modalType: 0,
      orderId: '',
      qrc: '',
      // #ifdef MP
      tableCode: {},
      // #endif
      moreShow: false,
      // 租赁id
      id: '',
      // 每期应付
      instal: {show: false, item: {first: 0, rent: 0, num: null}},
      priceGroup: {},
      orderLease: {}, // 租赁信息
      payTip: false, // 扣款提醒
      latitude: '',
      longitude: '',
      deviceModel: '',
      faceCheck: 'init',
      from: undefined, // 快捷下单
      leaseTime: {
        start: '',
        end: '',
        duration: ''
      },
      buyout_money_end: 0,
      is_super: 0, //是否至尊会员订单
      fromToken:''  //外部token
    };
  },
  computed: {
    giftCount() {
      let count = 0;
      if (this.giveCartInfo.length) {
        count = this.giveCartInfo.length
      }
      if (this.giveData.give_coupon.length) {
        count = count + this.giveData.give_coupon.length
      }
      if (this.giveData.give_integral > 0) {
        count = count + 1
      }
      return count
    },
    ...mapGetters(['isLogin']),
  },
  onLoad: function (options) {
    console.log('详情页面参数', options)
    // 解析支付宝二维码多个参数
    if(options?.params){
      options=JSON.parse(options.params)
      console.log('解析支付宝二维码多个参数',options)
    }
    // 快捷下单-外部token登录
    if (!this.isLogin && options.token) {
      this.fromToken= options.token
      let time = options.expires_time - this.$Cache.time();
      this.$store.commit('LOGIN', {token: options.token, time: time});
      this.$Cache.clear('snsapiKey');
      console.log('快捷下单：订单详情-登录成功')
    }

    // 快捷下单&交易组件（支付宝订单中心）：
    // 参数被编码为option的第一个key，取出key，重新组成对象
    if (Object.keys(options).length === 1 && Object.keys(options)[0].indexOf('from') !== -1) {
      //  解码,获取options的第一个key，然后解码这个key
      let a = Object.keys(options)[0]
      //  把参数转成对象
      if (a) {
        let b = a.split('&')
        let c = {}
        b.forEach(item => {
          let d = item.split('=')
          c[d[0]] = d[1]
        })
        console.log('解码最后的数据', c)
        options = c
      }
    }
    // 快捷下单：插件跳转
    if (options.from) {
      this.$set(this, 'from', options.from);
    }
    // 代课下单 id
    if (getApp().globalData.orderId) {
      options.order_id = getApp().globalData.orderId
    }
    if (options.order_id) {
      this.$set(this, 'order_id', options.order_id);
      this.$set(this, 'id', options.id);
      this.isReturen = options.isReturen;
    }

    if (options.merchantId && options.orderId && options.tenantId) {
      this.$set(this, 'order_id', options.orderId);
      this.$set(this, 'id', options.tenantId);
    }
    if (options.invoice_id) {
      this.invoice_id = options.invoice_id
    }
    this.activityCodeApi();

    if (this.themeColor) {
      uni.setNavigationBarColor({
        frontColor: '#ffffff',
        backgroundColor: this.themeColor,
      })
    }
    if(appCanGetId){
      this.hasIdApi=true
    }
  },
  onShow() {
    let that = this
    uni.getSystemInfo({
      success: function (info) {
        if (info.deviceModel != undefined) {
          that.deviceModel = info.deviceModel
        } else if (info.model != undefined) {
          that.deviceModel = info.model
        }
        console.log('设备', that.deviceModel);
      }
    });
    // uni.getLocation({
    // 	type: 'gcj02',
    // 	success: (res) => {
    //     console.log(res)
    // 	}
    // });
    uni.removeStorageSync('form_type_cart');

    // 等待人脸认证结果，则不请求订单详情
    if (this.faceCheck === 'start') return

    this.getOrderInfo();


    // 刷新收货地址
    if(this.address.address){
      this.$nextTick(function() {
        this.$refs.addressWindow.getAddressList();
      })
    }
  },
  methods: {
    // 选择地址
    OnChangeAddress: function(addressID,addressInfo) {
      this.addressId = addressID;
      this.addressInfo=addressInfo;
      this.changeClose()
    },
    openAddress(){
      this.address.address = true;
      // 获取用户收货地址列表
      this.$nextTick(function() {
        this.$refs.addressWindow.getAddressList();
      })
      // if(this.orderInfo._status._type===98){
      //   this.$refs.popup.close()
      // }
    },
    changeClose: function() {
      this.$set(this.address, 'address', false);
      // if(this.orderInfo._status._type===98){
      //   this.$refs.popup.open()
      // }
    },
    getId(){
      Routine.getCode().then(code => {
          bindingAlipayAuth({code:code,user_id:this.userInfo.uid}).then(res=>{
            if(res.status===200){
              this.daikeUser.card_id=res.data.cert_no
              this.daikeUser.real_name=res.data.user_name
              this.idDisabled=true
            }
          })
        })
    },
    daikeConfirm() {
      if(!this.addressId){
        this.$util.Tips({title: '请选择收货地址'})
        return
      }
      if(!this.daikeUser.real_name){
        this.$util.Tips({title: '请输入真实姓名'})
        return
      }
      if(!this.daikeUser.card_id){
        this.$util.Tips({title: '请输入身份证号'})
        return
      }

      // 绑定订单
      daikeBind({
        order_id: this.orderInfo.id,
        user_id: this.userInfo.uid,
        address_id: this.addressId,
        real_name: this.daikeUser.real_name,
        card_id: this.daikeUser.card_id,
      }).then(res=>{
        if(res.status==200){
          this.$refs.popup.close()

          // 订阅消息
          uni.showModal({
            title: '提交成功',
            content: '信息提交成功，等待后台审核通知',
            showCancel:false,
            confirmText:'订阅审核通知',
            success: function (res) {
              if (res.confirm) {
                bookZfbMsg('daike')
              }
            }
          });

          // 刷新详情
          this.getOrderInfo()
        }
      })



      return;
      // 待绑定，输入身份证号
      if (this.orderInfo._status._type === 98) {
        if (this.cardId.length !== 6) {
          this.$util.Tips({title: '请输入身份证号后6位'})
          return
        }
        bingAdminOrder(this.orderInfo.id, {
          last_limit: 6,
          card_id_last: this.cardId,
          deviceModel: this.deviceModel,
          latitude: this.latitude,
          longitude: this.longitude
        }).then(res => {
          this.$refs.popup.close()
          // 人脸识别
          this.getVerifyUser(this.orderInfo.unique)
        }).catch(err => {
          this.$util.Tips({title: err})
        })
      }
      if (this.orderInfo._status._type === 99) {
        this.$refs.popup.close()
        // 人脸识别
        this.getVerifyUser(this.orderInfo.unique)
      }
    },


    buyoutEnd(){
      if(this.orderLease.buyout_final_money>0){
        this.buyout_money_end = this.orderLease.buyout_final_money
      }else{
        this.buyout_money_end = parseFloat(this.orderLease.buyout_money - this.orderInfo.total_price).toFixed(2)
      }
    },
    completeData,
    returnRecord(){
      uni.navigateTo({
        url:`/pages/goods/lease_order_return/record?order_id=${this.orderInfo.order_id}`
      })
    },
    // 归还商品
    returnGoods() {
      // uni.navigateTo({url: `/pages/goods/lease_order_refund_goods/index?orderId=${this.order_id}`})
      uni.navigateTo({
        url:`/pages/goods/lease_order_return/index?order_id=${this.orderInfo.order_id}`
      })
    },
    // 买断商品
    goBuyout(){
      uni.navigateTo({
        url:`/pages/goods/lease_order_buyout/index?order_id=${this.orderInfo.order_id}`
      })
    },
    // 续租
    goXuzu(){
      uni.navigateTo({
        url:`/pages/goods/lease_order_xuzu/index?order_id=${this.orderInfo.order_id}`
      })
    },
    goContract() {
      uni.showLoading({
        title: '加载合同中',
      })
      let id = this.orderInfo.id
      getDownLoadUrl(id).then(res => {
        let url = [1, 3].includes(this.orderInfo.order_lease.check_type) ? res.data.download_url : res.data.url
        uni.downloadFile({
          url: url,
          success: (res) => {
            uni.hideLoading()
            if (res.statusCode === 200) {
              uni.openDocument({
                filePath: res.tempFilePath,
                fileType: 'pdf',
                fail: (err) => {
                  this.$util.Tips({title: '合同加载失败'})
                }
              });
            }
          },
          fail: (err) => {
            uni.hideLoading()
            this.$util.Tips({title: '合同加载失败'})
          }
        });
      })
    },
    verifyOk() {
      this.faceCheck = 'end'
      this.getOrderInfo();
      // this.getUserInfo();
      this.$refs.popup.close()
    },
    codeInput(e) {
      this.cardId = e
    },

    toChat() {
      this.$refs.chatModal.open()
      return;

      let userInfo = {}
      if (typeof this.userInfo === 'string') {
        userInfo = JSON.parse(this.userInfo)
      } else {
        userInfo = this.userInfo
      }
      let url = `/pages/extension/customer_list/chat?productId=${this.orderInfo.id}`
      this.$util.getCustomer(userInfo, url)
    },
    contractOK() {
      this.getOrderInfo();
      this.getUserInfo();
    },
    changeCheckType() {
      changeCheckType(this.orderInfo.id).then(res => {
        if (res.status === 200) {
          this.$util.Tips({title: '操作成功'})
          this.getOrderInfo();
        }
      })
    },
    depositPay() {
      this.depositLeasePay(this.orderInfo.id)
    },
    depositPaySuccess(){
      this.getOrderInfo()
    },
    // zhimaCreatePre() {
    //   let that = this
    //   //获取当前完整路径
    //   const pages = getCurrentPages(); // 获取页面栈
    //   const currentPage = pages[pages.length - 1]; // 当前页面
    //
    //   // 创建交易组件
    //   my.checkBeforeAddOrder({
    //     success({requireOrder, sceneId, sourceId}) {
    //       tradeCreate({
    //         oid: that.orderInfo.id,
    //         source_id: sourceId,
    //         path: 'pages/goods/lease_order_details/index'
    //       }).then(res => {
    //         if (res.status === 200) {
    //           // 唤起去免押
    //           that.zhimaCreate(that.orderInfo.id)
    //         }
    //       })
    //     },
    //     fail({error, errorMessage}) {
    //       that.$util.Tips({title: '订单前置判断失败'})
    //     },
    //     complete(e) {
    //       // console.log(e)
    //     },
    //   })
    // },
    zhimaResult(res) {
      if (res.resultCode == 9000) {
        uni.showLoading({
          title: '加载中...'
        });
        setTimeout(()=>{
          uni.hideLoading()
          this.getOrderInfo()
        },1000)

        // this.$util.Tips({title: '免押成功'})
      } else {
        this.$util.Tips({title: '免押失败'})
      }
    },
    // 创建芝麻免押订单
    // zhimaCreate() {
    //   zhimaCreate({
    //     oid: this.orderInfo.id
    //   }).then(res => {
    //     uni.hideLoading()
    //     if (res.status === 200) {
    //       my.tradePay({
    //         orderStr: res.data.orderStr, // 完整的支付参数拼接成的字符串，从 alipay.fund.auth.order.app.freeze 接口获取
    //         complete: (res) => {
    //           if (res.resultCode === '9000') {
    //             this.getOrderInfo()
    //             this.$util.Tips({title: '免押成功'})
    //           } else {
    //             this.$util.Tips({title: '免押失败'})
    //           }
    //         }
    //       });
    //     }
    //   }).catch(err => {
    //     this.$util.Tips({
    //       title: err.msg,
    //       icon: 'error'
    //     });
    //     uni.hideLoading()
    //   })
    // },
    zhimaPay() {
      zhimaPay({
        oid: this.orderInfo.id,
        num: 1
      }).then(res => {
        uni.hideLoading()
        if (res.status === 200) {
          this.$util.Tips({title: '支付成功'})
          this.getOrderInfo()
        } else {
          this.$util.Tips({
            title: res.msg,
            icon: 'error'
          });
        }
        uni.hideLoading()
      }).catch(err => {
        uni.hideLoading()
        this.$util.Tips({
          title: err,
          icon: 'error'
        });
      })
    },
    esignSign() {
      let contract_detail = JSON.parse(this.orderInfo.order_lease.contract_detail);
      console.log('contract_detail:', contract_detail.signUrl);
      // return;
      uni.navigateTo({
        url: '/pages/annex/web_view/index?url=' + encodeURIComponent(contract_detail.signUrl)
      })
    },
    onLoadFun() {
      this.getOrderInfo();
      this.getUserInfo();
      this.isShowAuth = false
    },
    // 授权关闭
    authColse: function (e) {
      this.isShowAuth = e
    },
    getpreviewImage: function (index, num) {
      uni.previewImage({
        urls: num ? this.orderInfo.refund_img : this.orderInfo.refund_goods_img,
        current: num ? this.orderInfo.refund_img[index] : this.orderInfo.refund_goods_img[index]
      });
    },
    showModalChange(type) {
      this.modalType = type;
      if (type == 1) {
        this.modalTitle = '确认收货';
        this.modalContent = '为保障权益，请收到货确认无误后，再确认收货';
      } else if (type == 2) {
        this.modalTitle = '删除订单';
        this.modalContent = '确定删除该订单?';
      } else if (type == 3) {
        this.modalTitle = '温馨提示';
        this.modalContent = '确认取消该订单?';
      }
      this.showModal = true;
    },
    handleTap(e) {
      let index = e.index;
      if (index == 1) {
        if (this.modalType == 1) {
          orderTake(this.order_id).then(res => {
            this.showModal = false;
            this.getOrderInfo();
            return this.$util.Tips({
              title: '操作成功',
              icon: 'success'
            });
          }).catch(err => {
            return this.$util.Tips({
              title: err
            });
          })
        } else if (this.modalType == 2) {
          orderDel(this.order_id).then(res => {
            this.showModal = false;
            return this.$util.Tips({
              title: '删除成功',
              icon: 'success'
            }, {
              tab: 3,
              url: '/pages/goods/lease_order_list/index'
            });
          })
        } else if (this.modalType == 3) {
          this.showModal = false;
          orderCancel(this.order_id).then(() => {
            uni.redirectTo({
              url: '/pages/goods/lease_order_list/index'
            })
          })
        }
      } else {
        this.showModal = false;
      }

    },
    hideModal() {
      this.showModal = false;
    },
    goGoodCall() {
      let url = `/pages/extension/customer_list/chat?orderId=${this.order_id}&isReturen=${this.isReturen}`
      let obj = {
        store_name: this.orderInfo.order_id,
        path: `/pages/goods/order_details/index?order_id=${this.orderInfo.order_id}`,
        image: ''
      }
      this.$util.getCustomer(this.userInfo, url, obj, 1)
    },
    openAfter: function (e) {
      let page = e;
      // #ifdef MP
      uni.showLoading({
        title: '正在加载',
      })
      openOrderRefundSubscribe().then(res => {
        uni.hideLoading();
        uni.navigateTo({
          url: page,
        });
      }).catch(() => {
        uni.hideLoading();
      });
      // #endif
      // #ifndef MP
      uni.navigateTo({
        url: page
      })
      // #endif
    },
    /**
     * 拨打电话
     */
    makePhone: function (phone) {
      let that = this;
      // #ifdef APP-PLUS
      plus.device.dial(phone, true);
      // #endif
      // #ifdef MP || H5
      uni.makePhoneCall({
        phoneNumber: phone
      });
      // #endif
    },
    showCodeChange() {
      if (!this.orderInfo.paid) return this.$util.Tips({
        title: '请支付后查看自提码'
      })
      this.showQrcode = true;
    },
    /**
     * 打开地图
     *
     */
    showMaoLocation: function () {
      if (!this.system_store.latitude || !this.system_store.longitude) return this.$util.Tips({
        title: '缺少经纬度信息无法查看地图！'
      });
      uni.openLocation({
        latitude: parseFloat(this.system_store.latitude),
        longitude: parseFloat(this.system_store.longitude),
        scale: 8,
        name: this.system_store.name,
        address: this.system_store.address + this.system_store.detailed_address,
        success: function () {

        },
      });
    },
    /**
     * 获取用户信息
     *
     */
    getUserInfo: function () {
      if(this.fromToken) return
      if(!this.isLogin)return
      let that = this;
      getUserInfo().then(async (res) => {
        that.userInfo = res.data;
        if(this.userInfo.real_name){
          this.daikeUser.real_name=this.userInfo.real_name
          this.daikeUser.card_id=this.userInfo.card_id
          this.idDisabled=true
        }

        this.showCompleteData=await completeData(res.data)
      }).finally(()=>{
        // 人脸认证
        this.daikeCheck()
      })
    },
    // 人脸认证(zyl 20250618 人脸认证统一移到下单后,即此处)
    daikeCheck(){
      this.$nextTick(() => {
        // if (!this.orderInfo.clerk_id) return
        // 代课下单：待绑定，输入身份证号或地址
        if (this.orderInfo.clerk_id && (!this.orderInfo.user_address || !this.userInfo.real_name)) {
          this.$refs.popup.open()
        } else if(this.orderInfo._status._type===99){
          // 通用逻辑：人脸识别
          let that = this
          // 第一次直接人脸，后面给个弹窗提示
          this.faceTimes+=1
          if(this.faceTimes===1){
            that.getVerifyUser(that.orderInfo.unique)
          }else{
            uni.showModal({
              title: '提示',
              content: `人脸识别验证身份`,
              success: function (res) {
                if (res.confirm) {
                  // 人脸识别
                  that.getVerifyUser(that.orderInfo.unique)
                }
              }
            })
          }
        }
      })
    },
    goUserData(){
      uni.navigateTo({url:'/pages/users/user_add_data/index'})
    },
    /**
     * 获取订单详细信息
     *
     */
    getOrderInfo: function () {
      let that = this;
      uni.showLoading({
        title: "正在加载中"
      });

      let apiDetail=''
      // 未登录，获取公共订单详情
      // if (!this.isLogin) {
        apiDetail = getPublicOrderDetail(this.order_id, {
          from: this.from
        });
      // } else {
      //   // 登录后，获取订单详细信息
      //   apiDetail = getOrderDetail(this.order_id, {
      //     from: this.from
      //   });
      // }
      apiDetail.then(res => {

        // 清除代课下单id
        getApp().globalData.orderId = ''
        let _type = res.data._status._type;
        uni.hideLoading();
        that.giveData.give_coupon = res.data.give_coupon;
        that.giveData.give_integral = res.data.give_integral;
        that.$set(that, 'orderInfo', res.data);
        that.$set(that, 'pid', res.data.pid);
        that.$set(that, 'split', res.data.split ? res.data.split : []);
        that.$set(that, 'evaluate', _type == 3 ? 3 : 0);
        that.$set(that, 'system_store', res.data.system_store);
        that.$set(that, 'invoiceData', res.data.invoice);
        if (that.invoiceData) {
          that.invoiceData.pay_price = res.data.pay_price;
        }
        that.$set(that, 'invoice_func', res.data.invoice_func);
        that.$set(that, 'special_invoice', res.data.special_invoice);
        that.$set(that, 'routineContact', Number(res.data.routine_contact_type));
        that.$set(that, 'orderLease', res.data.order_lease);
        that.$set(that, 'is_super', res.data.is_super);
        // 每期租金
        that.instal.item = {
          rent: res.data.order_lease.per_price,
          num: res.data.order_lease.lease_num - 1,
          first: res.data.order_lease.first_rent,
        }
        // 到期买断尾款
        this.buyoutEnd()
        // this.buyout_money_end = parseFloat(this.orderLease.buyout_money - this.orderInfo.total_price).toFixed(2)
        // console.log('=========到期买断尾款=>', this.buyout_money_end)
        let cartInfo = res.data.cartInfo;
        let cartObj = [],
            giftObj = [];
        cartInfo.forEach(item => {
          if (item.is_gift == 1) {
            giftObj.push(item)
          } else {
            cartObj.push(item)
          }
        })
        that.$set(that, 'cartInfo', cartObj);
        that.$set(that, 'giveCartInfo', giftObj);
        this.$nextTick(function () {
          that.config.qrc.code = that.orderInfo.verify_code
        })
        if (this.orderInfo.refund_status != 0) {
          this.isGoodsReturn = true;
        } else {
          this.isReturen = 0
        }
        if (that.invoice_id && !that.invoiceData) {
          that.invChecked = that.invoice_id || '';
          this.invoiceApply()
        }
        // #ifdef MP
        if (that.orderInfo.type == 10) {
          that.getCodeData();
        }
        // #endif
        that.getOrderStatus();

        // 扣款中提示：如果是从e签宝合同页面返回， 并且合同签署成功， 则提示
        if (this.payTip && this.orderInfo.order_lease.contract_status == 2) {
          this.payTip = false
          uni.showLoading({
            title: '合同签署成功，扣款中',
          })
          setTimeout(() => {
            this.getOrderInfo()
            uni.hideLoading()
          }, 3000)
        }

        // 人脸通过，没有地址，则绑定地址
        if (!this.orderInfo.current_address && this.orderInfo.order_lease.face_auth_status == 2) {
          let that = this
          uni.getLocation({
            type: 'gcj02',
            success: (res) => {
              that.latitude = res.latitude;
              that.longitude = res.longitude;
              bingAdminOrder(that.orderInfo.id, {
                deviceModel: that.deviceModel,
                latitude: that.latitude,
                longitude: that.longitude
              }).then(res => {
                // that.getOrderInfo()
                // 提示支付宝开启定位权限：关闭
                that.$refs.latShow.close()
              })
            },
            fail: (res) => {
              console.log(res)
              // #ifdef MP-ALIPAY
              that.$refs.latShow.open()
              // #endif
            }
          });
        }

        // 快捷下单：人脸识别
        // if(this.orderInfo.order_lease.face_auth_status!=2){
        //   let that=this
        //   uni.showModal({
        //     title: '提示',
        //     content: `人脸识别验证身份`,
        //     showCancel: false,
        //     success: function (res) {
        //       if (res.confirm) {
        //         uni.showLoading({ title: '加载中' })
        //         setTimeout(()=>{
        //           uni.hideLoading()
        //           let path='pages/goods/lease_order_details/index'
        //           // 小程序取当前页面路径
        //           const pages = getCurrentPages();
        //           const currentPage = pages[pages.length - 1].route;
        //           // 倒计时结束后,如果还在当前页面,则跳转人脸识别
        //           if(currentPage===path){
        //             that.getVerifyUser(that.orderInfo.unique)
        //           }
        //         },1000)
        //       }
        //     },
        //     fail: function(err) {
        //         console.log(err)
        //      }
        //   })
        // }

        //   租赁时间范围
        // 1 自定义
        if (res.data.cartInfo[0].productInfo.attrInfo.lease_days == -1) {
          this.leaseTime.start = moment(res.data.order_lease.start_time * 1000).format("YYYY-MM-DD")
          this.leaseTime.end = moment(res.data.order_lease.end_time * 1000).format("YYYY-MM-DD")
          this.leaseTime.duration = moment(this.leaseTime.end).diff(moment(this.leaseTime.start), 'days') + 1
        }

        //   优惠金额处理  废弃
        // this
        // if (this.orderInfo.quick_order_detail && res.data.quick_order_detail.order_detail && res.data.quick_order_detail.order_detail.promo_info) {
          // let order_detail = this.orderInfo.quick_order_detail.order_detail
          // let installment_plan_promo_detail_info_list = order_detail.promo_info.stage_promo_detail_list[0].installment_plan_promo_detail_info_list
          // let first_amount = 0
          // if (parseFloat(installment_plan_promo_detail_info_list[0].promo_amount) > 0) {
          //   first_amount = (parseFloat(installment_plan_promo_detail_info_list[0].plan_pay_amount) - parseFloat(installment_plan_promo_detail_info_list[0].promo_amount)).toFixed(2)
          // }
          // let total_price = 0
          // if (parseFloat(order_detail.promo_info.total_amount) > 0) {
          //   total_price = (parseFloat(this.orderInfo.total_price) - parseFloat(order_detail.promo_info.total_amount)).toFixed(2)
          // }
          // this.aliCouponMoney = {
          //   // 平台优惠
          //   platform_total_amount: parseFloat(order_detail.promo_info.platform_total_amount).toFixed(2),
          //   // 商家优惠
          //   merchant_total_amount: parseFloat(order_detail.promo_info.merchant_total_amount).toFixed(2),
          //   // 优惠后总租金
          //   total_price: total_price,
          //   // 优惠总金额
          //   total_amount: order_detail.promo_info.total_amount,
          //   // 优惠后首期租金
          //   first_amount: first_amount,
          //   //   优惠分期账单
          //   installment_plan_promo_detail_info_list: installment_plan_promo_detail_info_list
          // }
        // }
      }).catch(err => {
        uni.hideLoading();
        if (err.status == 403) {
          uni.navigateTo({
            url: '/pages/goods/lease_order_list/index'
          })
        }
        // else {
        // 	that.$util.Tips({
        // 		title: err
        // 	}, '/pages/goods/lease_order_list/index');
        // }
      }).finally(()=>{
        this.getUserInfo();
      })
    },
    // 不开发票
    invCancel() {
      this.invChecked = '';
      this.invTitle = '不开发票';
      this.invShow = false;
    },
    // 选择发票
    invSub(id) {
      this.invChecked = id;
      let data = {
        order_id: this.order_id,
        invoice_id: this.invChecked
      }
      makeUpinvoice(data).then(res => {
        uni.showToast({
          title: '申请成功',
          icon: 'success'
        });
        this.invShow = false;
        this.getOrderInfo()
      }).catch(err => {
        uni.showToast({
          title: err,
          icon: 'none'
        });
      });
    },
    // 关闭发票
    invClose() {
      this.invShow = false;
      this.getInvoiceList()
    },
    //申请开票
    invoiceApply() {
      this.getInvoiceList()
      this.moreBtn = false;
      this.invShow = true;
    },
    getInvoiceList() {
      uni.showLoading({
        title: '正在加载…'
      })
      invoiceList().then(res => {
        uni.hideLoading();
        this.invList = res.data.map(item => {
          item.id = item.id.toString();
          return item;
        });
        const result = this.invList.find(item => item.id == this.invChecked);
        if (result) {
          let name = '';
          name += result.header_type === 1 ? '个人' : '企业';
          name += result.type === 1 ? '普通' : '专用';
          name += '发票';
          this.invTitle = name;
        }
      }).catch(err => {
        uni.showToast({
          title: err,
          icon: 'none'
        });
      });
    },
    more() {
      this.moreBtn = !this.moreBtn
    },
    copy(code) {
      let that = this
      uni.setClipboardData({
        data: code,
        success: function () {
          that.$util.Tips({
            title: '复制成功'
          })
        }
      });
    },
    copyCard() {
      let that = this;
      let strArr = [];
      this.orderInfo.virtual_info.forEach((item, index) => {
        strArr.push(`卡号${index + 1}: ${item.card_no}  密码${index + 1}:${item.card_pwd}`)
      })
      uni.setClipboardData({
        data: strArr.toString()
      });
    },
    /**
     * 设置底部按钮
     *
     */
    getOrderStatus: function () {
      let orderInfo = this.orderInfo || {},
          _status = orderInfo._status || {
            _type: 0
          },
          status = {};
      let type = parseInt(_status._type),
          delivery_type = orderInfo.delivery_type,
          seckill_id = orderInfo.seckill_id ? parseInt(orderInfo.seckill_id) : 0,
          bargain_id = orderInfo.bargain_id ? parseInt(orderInfo.bargain_id) : 0,
          discount_id = orderInfo.discount_id ? parseInt(orderInfo.discount_id) : 0,
          combination_id = orderInfo.combination_id ? parseInt(orderInfo.combination_id) : 0;
      status = {
        type: type == 9 ? -9 : type,
        class_status: 0,
        class_again: 0
      };
      if (type == 1 && combination_id > 0) status.class_status = 1; //查看拼团
      if (type == 2 && delivery_type == 'express') status.class_status = 2; //查看物流
      if (type == 2) status.class_status = 3; //确认收货
      if (type == 4 || type == 0) status.class_status = 4; //删除订单
      if (!seckill_id && !bargain_id && !combination_id && !discount_id && !orderInfo.type && (type == 3 ||
          type == 4)) status.class_status = 5; //再次购买（待评价、已完成）
      if (!seckill_id && !bargain_id && !combination_id && !discount_id && !orderInfo.type && (type == 1 || type == 2 ||
          type == 5)) status.class_again = 6; //再次购买 （待发货、待收货、部分核销）
      this.$set(this, 'status', status);
    },
    /**
     * 去拼团详情
     *
     */
    goJoinPink: function () {
      uni.navigateTo({
        url: '/pages/activity/goods_combination_status/index?id=' + this.orderInfo.pink_id,
      });
    },
    /**
     * 再此购买
     *
     */
    goOrderConfirm: function () {
      let that = this;
      orderAgain(that.orderInfo.order_id).then(res => {
        return uni.navigateTo({
          url: '/pages/goods/order_confirm/index?new=1&cartId=' + res.data.cateId + '&store_id=' + that.orderInfo.store_id
        });
      }).catch(err => {
        return that.$util.Tips({
          title: err
        });
      });
    },
    confirmOrder(orderId) {
      let that = this;
      // #ifdef MP
      if (wx.openBusinessView && this.orderInfo.order_shipping_open && this.orderInfo.trade_no) {
        uni.showLoading({
          title: '加载中'
        });
        wx.openBusinessView({
          businessType: 'weappOrderConfirm',
          extraData: {
            transaction_id: this.orderInfo.trade_no
          },
          success() {
          },
          fail(err) {
            uni.hideLoading();
            return that.$util.Tips({
              title: err.errMsg
            });
          },
          complete() {
            uni.hideLoading();
          }
        });
      } else {
        that.showModalChange(1);
      }
      // #endif
      // #ifndef MP
      this.showModalChange(1);
      // #endif
    },
    // 代扣主动支付
    createWithholdActivepay() {
      createWithholdActivepay(this.orderInfo.id, {
        period_num: 1
      }).then(res => {
        uni.requestPayment({
          provider: 'alipay',
          orderInfo: res.data.tradeNo,
          complete: (e) => {
            if (e.resultCode == 9000) {
              // 查询支付结果
              this.zulinQuery(1)
            } else {
              this.$util.Tips({title: '支付失败'})
            }
          }
        })
      })
    },
    // 支付结果
    payResult(){
      this.getOrderInfo()
    },
    // 支付宝支付
    // payAlipay() {
    //   uni.showLoading({
    //     title: '加载中...'
    //   })
    //   let that = this
    //   leasePay(this.orderInfo.id, {
    //     num: 1,
    //     paytype: 'alipay',
    //     from: 'ali_routine',
    //     quitUrl: 'pages/goods/lease_order_details/index'
    //   }).then(res => {
    //     let status = res.data.status,
    //         orderId = res.data.result.order_id || '',
    //         jsConfig = res.data.result.jsConfig;
    //     switch (status) {
    //       case 'ALIPAY_PAY':
    //         console.log('ALIPAY_PAY_MP-ALIPAY');
    //         uni.requestPayment({
    //           provider: 'alipay',
    //           orderInfo: jsConfig.tradeNo,
    //           success: (e) => {
    //             console.log(e)
    //             if (e.resultCode == "6001") {
    //
    //             } else {
    //               that.$util.Tips({title: '支付成功'})
    //             }
    //           },
    //           fail: (e) => {
    //             console.log('ALIPAY_PAY_fail', e);
    //             that.$util.Tips({title: '支付失败'})
    //           },
    //           complete: () => {
    //             that.getOrderInfo()
    //           },
    //         });
    //         break;
    //     }
    //   }).finally(() => {
    //     uni.hideLoading()
    //   })
    // },
    // 查询支付结果
    zulinQuery(period_num) {
      queryWithholdActivepay(this.orderInfo.id, {period_num}).then(res => {
        this.getOrderInfo()
        this.$util.Tips({title: "支付成功"})
      }, err => this.$util.Tips({title: err}))
    },
    pay_open() {
      uni.reLaunch({
        url: `/pages/goods/cashier/index?order_id=${this.order_id}&from_type=order`
      })
    },
    goPage(type, url) {
      if (type == 1) {
        uni.navigateTo({
          url
        })
      } else if (type == 2) {
        uni.switchTab({
          url
        })
      } else if (type == 3) {
        uni.navigateBack();
      }

    },
    openSubcribe: function (item, productType) {
      let cartIds = [
        {
          cart_id: item.id,
          cart_num: parseInt(item.cart_num) - parseInt(item.refund_num)
        }
      ]
      cartIds = JSON.stringify(cartIds);
      let page = `/pages/goods/goods_return/index?orderId=` + this.order_id + '&id=' + this.orderInfo.id + '&cartIds=' + cartIds + '&productType=' + productType + '&store_id=' + this.orderInfo.store_id;
      // #ifdef MP
      uni.showLoading({
        title: '正在加载',
      })
      openOrderRefundSubscribe().then(res => {
        uni.hideLoading();
        uni.navigateTo({
          url: page,
        });
      }).catch(() => {
        uni.hideLoading();
      });
      // #endif
      // #ifndef MP
      uni.navigateTo({
        url: page
      })
      // #endif
    },
    evaluateTap: function (unique, orderId) {
      uni.navigateTo({
        url: "/pages/goods/goods_comment_con/index?unique=" + unique + "&uni=" + orderId
      })
    },
    closeDrawer() {
      this.showGiftDrawer = false;
    },
    activityCodeApi() {
      if(!this.isLogin)return
      activityCodeApi(91, 0, {
        order_id: this.order_id
      }).then(res => {
        const {
          routineUrl,
          wechatUrl
        } = res.data;
        // #ifdef MP
        this.qrc = routineUrl;
        // #endif
        // #ifdef H5
        if (this.$wechat.isWeixin()) {
          this.qrc = wechatUrl;
        }
        // #endif
      });
    },
    // #ifdef MP
    getCodeData() {
      getCodeData({
        tableId: this.orderInfo.activity_id
      }).then(res => {
        this.tableCode = res.data;
      });
    },
    // #endif
    tabMore() {
      this.moreShow = !this.moreShow;
    },
    // 分期账单
    goInstallment() {
      uni.navigateTo({
        url: `/pages/goods/lease_installment/index?id=${this.orderInfo.id}&check_type=${this.orderInfo.order_lease.check_type}&order_id=${this.orderInfo.order_id}`
      })
    },
    // 我的卡项
    goUserCard(){
      uni.navigateTo({
        url: '/pages/users/user_card_list/index'
      })
    }
  },
  onPullDownRefresh() {
    this.getOrderInfo()
    setTimeout(function () {
      uni.stopPullDownRefresh()
    }, 300);
  }
}
</script>
<style lang="scss" scoped>
.white_jianbian {
  height: 120rpx;
  background: linear-gradient(0deg, #F5F5F5 0%, rgba(245, 245, 245, 0) 100%);
}

.bt_line {
  height: 1px;
  width: 680rpx;
  left: 50%;
  transform: translateX(-50%);
}

.h-68 {
  height: 68rpx;
}

.order_goods ~ .order_goods {
  margin-top: 32rpx;
}

.con_border {
  border: 1px solid var(--view-theme);
  line-height: 22rpx;
}

.cell input {
  width: 450rpx;
  text-align: right;
}

.cell .radio {
  margin: 0 22rpx;
  padding: 10rpx 0;
}

.cell ~ .cell {
  margin-top: 40rpx;
}

.SemiBold {
  font-family: SemiBold;
}

.copy_btn {
  width: 68rpx;
  height: 36rpx;
  background: #F5F5F5;
  border-radius: 20rpx;
  text-align: center;
  line-height: 36rpx;
}

.btn ~ .btn {
  margin-left: 16rpx;
}

.border {
  border: 1rpx solid #ccc;
}

.border_bb {
  border-bottom: 1px solid #eee;
}

.h-128 {
  height: 128rpx;
}

.w-578 {
  width: 578rpx;
}

.bg-primary-light {
  background: var(--view-minorColorT);
}

.mt-228 {
  margin-top: 228rpx;
}

.virtual_info {
  margin-top: -160rpx;
}

.bt {
  border-top: 1px solid #eee;
}

.z-1 {
  z-index: 1;
}

.gold {
  color: #DCA658;
}

.card-pasd {
  color: #FF7D00;
}

.more-box {
  position: relative;

  .more {
    font-size: 24rpx;
    line-height: 34rpx;
    color: #333333;

    .iconfont {
      font-size: 24rpx;
    }
  }

  .popover {
    position: absolute;
    inset: -18rpx auto auto 20rpx;
    width: 160rpx;
    padding: 14rpx 0;
    border-radius: 16rpx;
    background: #FFFFFF;
    box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0, 0, 0, 0.08);
    transform: translateY(-100%);
    visibility: hidden;
    opacity: 0;
    z-index: 1;
    transition: all .3s ease-in-out;

    &.on {
      visibility: visible;
      opacity: 1;
      z-index: 970;
    }

    .arrow {
      position: absolute;
      inset: auto auto -13rpx 8rpx;
      border-width: 7rpx 13rpx;
      border-style: solid;
      border-color: #FFFFFF transparent transparent;
    }

    .item {
      padding: 14rpx 24rpx;
      font-size: 28rpx;
      color: #333333;
    }
  }
}

.collapse-box {
  /deep/ .uni-collapse-item__title-wrap {
    text-align: right;
    margin-bottom: 10rpx;
  }

  /deep/ .uni-collapse-item__title-arrow {
    margin-right: 0 !important;
    margin-top: -10rpx !important;
  }

  /deep/ .uni-collapse-item__wrap-content {
    border: none !important;
  }
}

//.has-code {
//  width: auto !important;
//}
  /deep/.uni-popup{
    z-index:100 !important;
  }
.daike-tip {
  width: 90vw;
  padding: 100rpx 36rpx 100rpx;
  background-color: #fff;
  border-radius: 20rpx;
  position: relative;
  overflow: hidden;
  input {
    flex: 1;
    font-size: 26rpx;
  }
  .address{
    border: 1rpx dashed #ddd;
    border-radius: 10rpx;
    padding: 20rpx;
    .has-address{

    }
    .no-address{
      display: flex;
      align-items: center;
    }
  }

  .title {
    font-size: 34rpx;
    font-weight: bold;
    position: absolute;
    top: 30rpx;
    left: 30rpx;
  }

  button {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    font-size: 28rpx;
    font-weight: bold;
    height: 90rpx;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tip2 {
    .desc {
      margin-top: 20rpx;
      font-size: 28rpx;
      color: #999;
    }
  }

  .tip3 {
    .tip {
      font-size: 32rpx;
      color: #999;
    }

    ///deep/input{
    //  width: 100%;
    //  margin-top: 30rpx;
    //}
  }
}

.lease-area {
  .l, .r {
    display: flex;
    align-items: center;

    .tag {
      //  渐变色
      background: linear-gradient(120deg, #e04b53 50%, #fafafa 100%);
      width: 42rpx;
      height: 42rpx;
      display: flex;
      justify-content: center;
      align-items: center;
      color: #fff;
      border-radius: 50%;
      margin-right: 6rpx;
    }

    .txt {
      color: #e04b53;
      font-weight: bold;
    }

    .tag2 {
      background: linear-gradient(120deg, #4884dc 50%, #fafafa 100%);
    }

    .txt2 {
      color: #4884dc;
    }
  }

  .c {
    padding: 1px;
    border-radius: 40rpx;
    //  渐变色
    background: linear-gradient(120deg, #e04b53 30%, #4884dc 100%);

    .c-day {
      background: #fff;
      border-radius: 40rpx;
      padding: 4rpx 20rpx;
    }

    .c-line-l, .c-line-r {
      width: 30rpx;
      height: 1rpx;
      background: #e04b53;
      position: absolute;
      top: 50%;
      border-radius: 1rpx;
    }

    .c-line-l {
      left: -30rpx;
    }

    .c-line-r {
      background: #4884dc;
      right: -30rpx;
    }
  }
}

.pop-box {
  height: 50vh;

  .main {
    .item {

    }
  }
}

.bottom-box {
  overflow-x: auto;
}
.data-tip{
  padding: 12rpx 20rpx;
  background-color: #fef9e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12rpx;
  font-size: 22rpx;
  color: #d07942;
  margin-top: 10rpx;
  line-height: 1;
  .l{
  }
  .r{
    border: 1px solid #d07942;
    padding: 8rpx 18rpx;
    border-radius: 30rpx;
  }
}
.btn-con{
  overflow-x: auto;
  //justify-content: flex-start;
  >.btn{
    flex: 0 0 auto;
  }
}
</style>
